/*
 *  Copyright (C) 2011  social-tourist.org
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.socialtourist.web.shared.data;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(detachable="true")
public class Need implements Serializable
{

	private static final long serialVersionUID = 1L;

	public static Need create(int quantity, String description)
	{
		return new Need(quantity, description);
	}
	
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String encodedKey;
	
	public String getEncodedKey() {
		return encodedKey;
	}

	public void setEncodedKey(String encodedKey) {
		this.encodedKey = encodedKey;
	}

	@Persistent
  	private SocialProject project; 
  	
	public SocialProject getProject() {
		return project;
	}

	public void setProject(SocialProject project) {
		this.project = project;
	}

	@Persistent
  	private int quantity;
	
	@Persistent
	private String description;
	
	@Persistent
	private Date satisfied;
	
	@Persistent
	private String satisfied_mail;
	
	public Need()
	{
		
	}
	
	public Need(int quantity, String description) {
		this.quantity = quantity;
		this.description = description;
		this.satisfied = null;
		this.satisfied_mail = null;
	}

	public String getDescription() {
		return description;
	}

	public int getQuantity() {
		return quantity;
	}

	public Date getSatisfied() {
		return satisfied;
	}

	public String getSatisfied_mail() {
		return satisfied_mail;
	}

	public boolean isSatified()
	{
		return satisfied != null;
	}
	
	public void setSatisfied(Date satisfied) {
		this.satisfied = satisfied;
	}
	
	public void setSatisfied_mail(String satisfied_mail) {
		this.satisfied_mail = satisfied_mail;
	}
	

}
